<?php 
	ob_start();
	session_start(); 
	require("location.php");
	require("../librarys/funs/quantri.php");
	
	$db = new db;
	$class_user = new user;
	$class_tin_root = new tin_root;
	$class_tin_theloai = new tin_theloai;
	$class_tin_loai = new tin_loai;
	$class_tin = new tin;
	$class_sanpham_chungloai = new sanpham_chungloai;
	$class_sanpham_loai = new sanpham_loai;
	$class_sanpham = new sanpham;
	$class_lienhe = new lienhe;
	$class_thuvienanh = new thuvienanh;
	$class_tin_tonghop = new tin_tonghop;
	$class_field = new field;
	$class_donhang = new donhang;
	$class_donhangchitiet = new donhangchitiet;
        $class_quangcao = new quangcao;
	
	if (isset($_GET['logout']) && $_GET['logout']==1) {
		unset($_SESSION['kiemtradangnhapthinguyet']);
		unset($_SESSION['taikhoandangnhapthinguyet']);
		unset($_SESSION['user_id']);
	}
	
	$p=$_GET['p'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quản trị Website</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<link href="css/khung-dn-dp-dk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="../scripts/script.js"></script>
<script type="text/javascript" charset="utf-8" src="../scripts/jquery-1.4.4.js"></script>
<script src="admin_script.js" type="text/javascript"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="ckfinder/ckfinder.js"></script>
<script type="text/javascript">
function BrowseServer( startupPath, functionData ){
	var finder = new CKFinder();
	finder.basePath = 'ckfinder/'; //Đường path nơi đặt ckfinder
	finder.startupPath = startupPath; //Đường path hiện sẵn cho user chọn file
	finder.selectActionFunction = SetFileField; // hàm sẽ được gọi khi 1 file được chọn
	finder.selectActionData = functionData; //id của text field cần hiện địa chỉ hình
	finder.selectThumbnailActionFunction = ShowThumbnails; //hàm sẽ được gọi khi 1 file thumnail được chọn
	finder.popup(); // Bật cửa sổ CKFinder
} //BrowseServer

function SetFileField( fileUrl, data ){
	document.getElementById( data["selectActionData"] ).value = fileUrl;
}
function ShowThumbnails( fileUrl, data ){
	var sFileName = this.getSelectedFile().name; // this = CKFinderAPI
	document.getElementById( 'thumbnails' ).innerHTML +=
	'<div class="thumb">' +
	'<img src="' + fileUrl + '" />' +
	'<div class="caption">' +
	'<a href="' + data["fileUrl"] + '" target="_blank">' + sFileName + '</a> (' + data["fileSize"] + 'KB)' +
	'</div>' +
	'</div>';
	document.getElementById( 'preview' ).style.display = "";
	return false; // nếu là true thì ckfinder sẽ tự đóng lại khi 1 file thumnail được chọn
}
</script>
</head>

<body>
	<div class="content">
    	<div class="top_left">
        	<strong style="font-size:18px;">NGUYETRAVEL</strong> <br/>
            137 A Hien Vuong- Phường Phú Thạnh, Tân Phú-HCM <br/>
            thynguyettravel@gmail.com
        </div>
        <div class="top_right">
            <div class="top_right_hotline">
                <strong style="color:#F8991D; font-size:18px;">HOTLINE:</strong> 
                <strong style="color:#FFFFFF; font-size:15px;">(084-8) 3979 7291 - 3979 7292 - 3979 7293 -3979 7294</strong> 
            </div>
            <div class="div_wellcome">
            	<ul>
                	<?php
						if(isset($_SESSION['kiemtradangnhapthinguyet']) && $_SESSION['kiemtradangnhapthinguyet']==1) {
							$user = $_SESSION['kiemtradangnhapthinguyet'];
					?>
                    <li>Chào mừng <?php echo $user['ten']; ?> đến với trang quản trị <b>VietnamTouris</b></li>
                    <li>
                    	<a href="../index.php">
                    	Quay về trang chủ
                   		</a>
                    </li>
                    <li>
                    	<a href="index.php?logout=1">
                    	Đăng xuất
                   		</a>
                    </li>
                    <?php
						}
						else {
					?>
                	<li>Chào mừng bạn đến với trang quản trị <b>VietnamTouris</b></li>
                    <li>
                    	<a href="../index.php">
                    	Quay về trang chủ
                   		</a>
                    </li>
                    <?php
						}
					?>
                </ul>
            </div>
        </div>
        
        <div class="main_top">&nbsp;</div>
        <div class="main_title"><strong><a href="admin.php" style="color:#000000;">BẢNG ĐIỀU KHIỂN</a></strong></div>
        <div class="main_content">
        	<?php
				if (isset($_SESSION['kiemtradangnhapthinguyet']) && $_SESSION['kiemtradangnhapthinguyet']==1) {
					include_once("menu.php");
					if ($p!="") {
					
						// Hệ thống
						$floder = "hethong";
						$table = "user";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						if ($p==$table."_manager_sua") {
							include_once("librarys/incs/".$floder."/".$table."_manager_sua.php");
						}
						
						// Tin tức
						$floder = "tin";
						$table = "tin_root";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "tin_theloai";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "tin_loai";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "tin";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						// Sản phẩm
						$floder = "sanpham";
						$table = "sanpham_chungloai";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "sanpham_loai";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "sanpham";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						// Thông tin khác
						$floder = "thongtinkhac";
						$table = "lienhe";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "thuvienanh";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
                                                
                                                $table = "quangcao";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "tin_tonghop";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_them") {
							include_once("librarys/incs/".$floder."/".$table."_them.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
						$table = "field";
						if ($p==$table."_quanly") {
							include_once("librarys/incs/".$floder."/".$table."_quanly.php");
						}
						if ($p==$table."_sua") {
							include_once("librarys/incs/".$floder."/".$table."_sua.php");
						}
						
					}
					else {
						include_once("trang_chu.php");
					}
				}
				else {
					include_once("login.php");
				}
			?>
        </div>
        <div class="main_bottom">&nbsp;</div>
        
    </div>

</body>
</html>